﻿using GalaSoft.MvvmLight;
using System.Windows;
using GalaSoft.MvvmLight.Command;
using System.Windows.Input;
using System.Collections.ObjectModel;
using UML_Creator.Model;
using System.Diagnostics;

namespace UML_Creator.ViewModel
{
    /// <summary>
    /// This class contains properties that the main View can data bind to.
    /// <para>
    /// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
    /// </para>
    /// <para>
    /// You can also use Blend to data bind with the tool's support.
    /// </para>
    /// <para>
    /// See http://www.galasoft.ch/mvvm/getstarted
    /// </para>
    /// </summary>
    public class MainViewModel : ViewModelBase
    {
        //List with Nodes which is displayed in the mainPanel
        //Changes in this Collection should directly change what is shown in the GUI, if all bindings are correct
        public ObservableCollection<Node> Nodes { get; set; }
        //Commands
        public ICommand AddCircle { get; private set; }
          
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel()
        {
                Nodes = new ObservableCollection<Node>();
                AddCircle = new RelayCommand(() => AddCircleExecute(), () => true);

        }

        private void AddCircleExecute()
        {
            Debug.WriteLine("Adding a circle");
            Nodes.Add(new Node());
        }
        ////public override void Cleanup()
        ////{
        ////    // Clean up if needed

        ////    base.Cleanup();
        ////}
    }
}